Data.gov.sg was launched in 2011 as the government’s one-stop portal to its publicly-available data sets from 70 public agencies.
A personal project
Find insights from making visualizations
Singapore is a small country facing unique challenges
Data from data.gov.sg and Department of Statistics Singapore.
The Singapore Open Data Licence aims to promote and enable easy reuse of Public Sector data to create value for the community and businesses
singapore_residents_by_age_group_ethnic_group_and_sex_end_june_annual <- read_csv("data/resident-population-by-ethnicity-gender-and-age-group/singapore-residents-by-age-group-ethnic-group-and-sex-end-june-annual.csv")## Rows: 22680 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): level_1, level_2, value
## dbl (1): year
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Convert from chr to dbl
singapore_residents_by_age_group_ethnic_group_and_sex_end_june_annual$value <- as.double(as.character(singapore_residents_by_age_group_ethnic_group_and_sex_end_june_annual$value))singapore_residents_by_age_group_ethnic_group_and_sex_end_june_annual %>%
filter(year == "2019" | level_1 == "Total Residents") %>%
gg_col(x = level_2,
y = value,
col = level_2,
title = "Resident Population by Age-group, 2019",
x_title = "",
y_title = "",
col_legend_place = "",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())## ℹ {ggblanket} merges col and fill aesthetics into a single col aesthetic
Singapore has one of the lowest fertility rates globally World Bank.
The crude birth rate is the annual number of live births per 1,000 population (WHO). But the calcuation used by Singapore is the number of live births in a given year, per thousand mid-year population.
crude_birth_rate <- read_csv("data/births-and-fertility-annual/crude-birth-rate.csv")## Rows: 59 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): level_1
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
crude_birth_rate %>%
gg_line(x = year,
y = value,
title = "Crude Birth Rate (per 1,000 popultaion)",
y_title = "",
x_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()Live-births are defined as occurring within Singapore and its territorial waters as registered under the Registration of Births and Deaths Act (Chapter 267). Data are compiled based on date of occurrence.
live_births <- read_csv("data/births-and-fertility-annual/live-births.csv")## Rows: 118 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): level_1, value
## dbl (1): year
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Convert from chr to dbl
live_births$value <- as.double(as.character(live_births$value))live_births %>%
filter(level_1 == "Total Live-births") %>%
gg_line(x = year,
y = value,
title = "Number of live births",
y_title = "",
x_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()The Total Fertility Rate refers to the average number of live-births each female would have during her reproductive years if she were to experience the age-specific fertility rates prevailing during the period. It is derived by aggregating the age-specific fertility rates of females in each of the reproductive ages for a specific year.
total_fertility_rate_by_ethnic_group <- read_csv("data/births-and-fertility-annual/total-fertility-rate-by-ethnic-group.csv")## Rows: 177 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): level_1, level_2
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
total_fertility_rate_by_ethnic_group %>%
gg_line(x = year,
y = value,
col = level_2,
title = "Total Fertility Rate by Ethnic Groups",
y_title = "",
x_title = "",
col_legend_place = "r",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()## ℹ {ggblanket} merges col and fill aesthetics into a single col aesthetic
Total Fertility Rate by Age Groups refer to the number of live-births to females in a particular age group, per thousand females in that age group during the period.
Data prior to 1980 pertain to total population.
Data from 1980 onwards pertain to resident population (i.e. Singapore citizens and permanent residents).
age_specific_fertility_rate <- read_csv("data/births-and-fertility-annual/age-specific-fertility-rate.csv")## Rows: 413 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): level_1, level_2, value
## dbl (1): year
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#convert value from chr to dbl
age_specific_fertility_rate$value <- as.double(as.character(age_specific_fertility_rate$value))age_specific_fertility_rate %>%
gg_line(x = year,
y = value,
col = level_2,
title = "Total Fertility Rate by Age Groups",
y_title = "",
x_title = "",
col_legend_place = "r",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()## ℹ {ggblanket} merges col and fill aesthetics into a single col aesthetic
life_expectancy_at_birth_and_age_65_years <- read_csv("data/life-expectancy-by-sex-annual/life-expectancy-at-birth-and-age-65-years.csv")## Rows: 86 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): level_1
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
life_expectancy_at_birth_and_age_65_years %>%
gg_line(x = year,
y = value,
col = level_1,
title = "Life Expectancy at Birth",
x_title = "",
y_title = "",
col_legend_place = "b",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()## ℹ {ggblanket} merges col and fill aesthetics into a single col aesthetic
life_expectancy_at_birth_and_age_65_years_by_sex <- read_csv("data/life-expectancy-by-sex-annual/life-expectancy-at-birth-and-age-65-years-by-sex.csv")## Rows: 172 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): level_1, level_2
## dbl (2): year, value
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
life_expectancy_at_birth_and_age_65_years_by_sex %>%
gg_line(x = year,
y = value,
col = level_2,
title = "Life Expectancy by Gender",
x_title = "",
y_title = "",
col_legend_place = "b",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()## ℹ {ggblanket} merges col and fill aesthetics into a single col aesthetic
total_number_of_deaths <- read_csv("data/principal-causes-of-death/total-number-of-deaths.csv")## Rows: 15 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): year, no_of_deaths
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
total_number_of_deaths %>%
gg_line(x = year,
y = no_of_deaths,
title = "Total Number of Deaths (Annual)",
x_title = "",
y_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()principal_causes_of_death <- read_csv("data/principal-causes-of-death/principal-causes-of-death.csv")## Rows: 152 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): icd, classification, disease_condition
## dbl (3): year, rank, percentage_deaths
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
principal_causes_of_death %>%
filter(year == "2020") %>%
gg_line(x = disease_condition,
y = percentage_deaths,
title = "Principal Causes of Death",
x_title = "",
col_title = "",
col_legend_place = "r",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_boxplot()## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
Being an island state, land is limited, and thus housing is a perennial issue.
The majority of people live in public housing, and the term evokes a different image compared to other countries.
flats_constructed_by_housing_and_development_board_annual <- read_csv("data/flats-constructed/flats-constructed-by-housing-and-development-board-annual.csv")## Rows: 41 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): year, flats_constructed
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
flats_constructed_by_housing_and_development_board_annual %>%
gg_line(x = year,
y = flats_constructed,
title = "Flats Constructed by Housing and Development Board (Annual)",
y_title = "",
x_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()Resale flat prices based on registration date from Jan-2017 onwards
resale_flat_prices_based_on_registration_date_from_jan_2017_onwards <- read_csv("data/resale-flat-prices/resale-flat-prices-based-on-registration-date-from-jan-2017-onwards.csv")## Rows: 127188 Columns: 11
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (8): month, town, flat_type, block, street_name, storey_range, flat_mode...
## dbl (3): floor_area_sqm, lease_commence_date, resale_price
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#convert value from chr to dbl
#resale_flat_prices_based_on_registration_date_from_jan_2017_onwards$month <- as.double(as.character(resale_flat_prices_based_on_registration_date_from_jan_2017_onwards$month))#resale_flat_prices_based_on_registration_date_from_jan_2017_onwards %>%
#gg_smooth_col(x_var = month,
# y_var = resale_price,
# col_var = flat_type,
# title = "Resale Flat Prices from Jan 2017",
# y_title = "",
# caption = "Graphic: @wyuet Source: data.gov.sg",
# theme = theme_light())value_of_local_food_production_in_singapore <- read_csv("data/value-of-local-food-production/value-of-local-food-production-in-singapore.csv")## Rows: 9 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (5): year, vegetables, seafood, hen_shell_eggs, local_landings
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#convert data to long format
value_of_local_food_production_in_singapore_long <- melt(value_of_local_food_production_in_singapore, id = "year")value_of_local_food_production_in_singapore_long %>%
gg_col(x = year,
y = value,
col = variable,
title = "Value of Local Food Production (million SGD)",
x_title = "",
y_title = "",
col_legend_place = "r",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())## ℹ {ggblanket} merges col and fill aesthetics into a single col aesthetic
carbon_dioxide_emissions_from_combustion_of_fossil_fuels <- read_csv("data/climate-change-and-energy-carbon-dioxide-emissions-from-combustion-of-fossil-fuels/carbon-dioxide-emissions-from-combustion-of-fossil-fuels.csv")## Rows: 7 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): year, co2_emissions
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
carbon_dioxide_emissions_from_combustion_of_fossil_fuels %>%
gg_line(x = year,
y = co2_emissions,
title = "Carbon Dioxide Emissions (From Combustion of Fossil Fuels)",
x_title = "",
y_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()waste_disposed_of_and_recycled_annual <- read_csv("data/waste-disposed-of-and-recycled-annual/waste-disposed-of-and-recycled-annual.csv")## Rows: 15 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (3): year, waste_disposed_of, waste_recycled
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#change data to long format
waste_disposed_of_and_recycled_annual_long <- melt(waste_disposed_of_and_recycled_annual, id = "year")waste_disposed_of_and_recycled_annual_long %>%
gg_col(x = year,
y = value,
col = variable,
title = "Waste Disposed Of And Recycled (Annual)",
x_title = "",
y_title = "",
col_legend_place = "r",
col_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light())## ℹ {ggblanket} merges col and fill aesthetics into a single col aesthetic
container_throughput_monthly <- read_csv("data/container-throughput-monthly-total/container-throughput-monthly.csv")## Rows: 328 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): month
## dbl (1): container_throughput
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#convert from chr to date
#container_throughput_monthly$month <- as.Date(container_throughput_monthly$month, "%y-%m")container_throughput_monthly %>%
gg_line(x = month,
y = container_throughput,
title = "Container Throughput, Monthly (in twenty-foot equivalent)",
x_title = "",
y_title = "",
caption = "Graphic: @wyuet. Source: data.gov.sg",
theme = theme_light()) +
geom_point()## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?